package com.wtone.platform.gat.images.gat.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSort;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.wtone.platform.gat.images.gat.model.*;
import com.wtone.platform.gat.images.gat.service.SubscribesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: aiLin
 * @Date: 2020/9/25 17:45
 * @desc: 订阅中心
 */
@Slf4j
@Api(tags = "订阅中心", value = "subscribes api")
@ApiSort(2)
@RestController
public class SubscribesController {

    @Autowired
    private SubscribesService subscribesService;

    @ApiOperation("订阅接口")
    @ApiOperationSort(value = 1)
    @RequestMapping(value = "/VIID/Subscribes", method = RequestMethod.POST, produces="application/json")
    public ResponseStatusListModeObject subscribes(@RequestBody SubscribeListObject subscribeListObject){
        return subscribesService.subscribes(subscribeListObject);
    }

    @ApiOperation("取消订阅")
    @ApiOperationSort(value = 3)
    @RequestMapping(value = "/VIID/Subscribes/{SubscribeID}", method = RequestMethod.PUT, produces="application/json")
    public ResponseStatusObject cancelSubscribeID(@PathVariable("SubscribeID") String SubscribeID, @RequestBody SubscribeObjects subscribeNotific){
        return subscribesService.cancelSubscribeID(SubscribeID,subscribeNotific);
    }

    @ApiOperation("订阅任务删除")
    @ApiOperationSort(value = 4)
    @RequestMapping(value = "/VIID/Subscribes", method = RequestMethod.DELETE, produces="application/json")
    public ResponseStatusListModeObject deleteSubscribeID(@RequestParam(name = "IDList") String IDList){
        return subscribesService.deleteSubscribeID(IDList);
    }

    @ApiOperation("订阅任务修改")
    @ApiOperationSort(value = 5)
    @RequestMapping(value = "/VIID/Subscribes", method = RequestMethod.PUT, produces="application/json")
    public ResponseStatusListModeObject updateSubscribeID(@RequestBody SubscribeListObject subscribeListObject){
        return subscribesService.updateSubscribeID(subscribeListObject);
    }

    @ApiOperation("订阅任务查询")
    @ApiOperationSort(value = 6)
    @RequestMapping(value = "/VIID/Subscribes", method = RequestMethod.GET, produces="application/json")
    public SubscribeListObject deleteSubscribeID(
            @RequestParam(name = "SubscribeID",required = false) String SubscribeID,
            @RequestParam(name = "ApplicantName",required = false) String ApplicantName,
            @RequestParam(name = "ApplicantOrg",required = false) String ApplicantOrg,
            @RequestParam(name = "BeginTime",required = false) String BeginTime,
            @RequestParam(name = "EndTime",required = false) String EndTime,
            @RequestParam(name = "Title",required = false) String Title,
            @RequestParam(name = "SubscribeDetail",required = false) String SubscribeDetail,
            @RequestParam(name = "ResourceClass",required = false) String ResourceClass,
            @RequestParam(name = "ReportInterval",required = false) String ReportInterval,
            @RequestParam(name = "Reason",required = false) String Reason,
            @RequestParam(name = "OperateType",required = false) String OperateType,
            @RequestParam(name = "SubscribeStatus",required = false)String SubscribeStatus,
            @RequestParam(name = "SubscribeCancelOrg",required = false)String SubscribeCancelOrg,
            @RequestParam(name = "SubscribeCancelPerson",required = false)String SubscribeCancelPerson,
            @RequestParam(name = "CancelTime",required = false)String CancelTime,
            @RequestParam(name = "CancelReson",required = false)String CancelReson,
            @RequestParam(name = "ResultImageDeclare",required = false)String ResultImageDeclare,
            @RequestParam(name = "ResultFeatureDeclare",required = false)String ResultFeatureDeclare,
            @RequestParam(name = "TabID",required = false)String TabID){
        return subscribesService.querySubscribeID( SubscribeID,ApplicantName,ApplicantOrg,BeginTime,EndTime,Title,SubscribeDetail,ResourceClass,ReportInterval,Reason,OperateType,SubscribeStatus,SubscribeCancelOrg,SubscribeCancelPerson,CancelTime,CancelReson,ResultImageDeclare,ResultFeatureDeclare,TabID);
    }
}

